
var storage = {

    setSession(key, value){
        sessionStorage.setItem(key, JSON.stringify(value));
    },
    getSession(key){
        return JSON.parse(sessionStorage.getItem(key));
    },
    removeSession(key){
        sessionStorage.removeItem(key);
    },
    clear(){
        sessionStorage.clear();
    },
    hasKey(key){
        if (sessionStorage.getItem(key) == null) {
            return false;
        }
        return true;
    },
    isSessionValid(this01) {
        sessionStorage.clear();
        this01.$store.commit('updateIsLogin', false);
        this01.$store.commit('updateUserInfo', null);
        this01.$router.push({name: 'login'});
    }
};

export default storage;